<#assign pageName="新增数据信息">
<@override name="page-content">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>${pageName}</legend>
    </fieldset>
    <form class="layui-form padding-10" lay-filter="formExampleAdd">
        <@ctrl.Textbox path="exampleInfo.name" labelText="姓名" required="required"/>
        <@ctrl.SingleSelect path="exampleInfo.sex" options={"男":"男", "女":"女"} 
            text="1" value="0" labelText="性别"/>
        <@ctrl.Textbox path="exampleInfo.birthday" labelText="出生日期"/>
        <@ctrl.CheckboxList path="exampleInfo.hobby" options={"1":"唱歌", "2":"跳舞", "3":"画画"} 
            textField="1" valueField="0" labelText="兴趣爱好"/>
        <@ctrl.Textarea path="exampleInfo.signature" labelText="个性签名" />
        <@ctrl.FormAction backURL = "manage"/>
    </form>
</@override>
<@override name="page-scripts">
<script>
     $(function(){
         layui.use(['form','layer','laydate','jquery'], function(){
             var form = layui.form;
             var layer=layui.layer;
             var laydate = layui.laydate;
             $=layui.jquery;
             laydate.render({
                 elem: '#birthday'
             });
             //监听提交
             form.on('submit(submit)', function(data){
                 var hobby_check = []; //定义一个临时数据
                 $("input:checkbox[name='hobby']:checked").each(function() {
                     hobby_check.push($(this).val());
                 });
                 data.field.hobby = hobby_check.toString();
                 submitData(data.field, '${contextPath}/examples/add', function(){location.href="${contextPath}/examples/manage";});
                 return false;
             });
         })
     })
</script>
</@override>
<@extends name="/layout/basepage.html"/> 